// packageH/signPage/signIndex/signIndex.js
const app = getApp();

Page({
  data: {
    member: {},
    details: {},
    person_contract: {},
    company_contract_list: []
  },

  onLoad: function (options) {
   
  },
  onShow: function () {
    this._getData();
  },

  _getData () {
    let requestUrl = app.getNetAddresss('plugin.yun-sign.frontend.h5.member.index');
    app._getNetWork({
      url: requestUrl,
      success: (resdata)=> {
        let res = resdata.data;
        if (res.result === 1) {
          if(res.data.member?.person_status) res.data.member.person_status = res.data?.person_status;
          this.setData({
            member: res.data.member,
            person_contract: res.data.person_contract || {},
            company_contract_list: res.data.company_contract_list || []
            });
        } else {
          app.tips(res.msg);
        }
      },
      fail (err) {
        console.log(err, "-----------");
      }
    });
  },

  toUrl(e) {
    let _data = e.currentTarget.dataset || {};
    this.wxRouterLink(_data);
  },
  wxRouterLink(_data) {
    let _Param = "";
    const { url, ...otherParam } = _data;
    Object.keys(otherParam).forEach(function (key) {
      if (otherParam[key] !== "") _Param += key + "=" + otherParam[key] + "&";
    });
    if (url === "") return;
    wx.navigateTo({
      url: url + "?" + _Param.slice(0, -1),
    });
  },
});